<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="com.lavegue.model.Area" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>数据列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<script type='text/javascript' src='dwr/interface/userdwr.js'></script>
     <script type='text/javascript' src='dwr/interface/areadwr.js'></script>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type='text/javascript' src='js/jquery.validate.min.js'></script>
 	<script type='text/javascript' src='js/common.js'></script>
	
	 <script type='text/javascript' src='<%=basePath %>/dwr/engine.js'></script>
	 <script type='text/javascript' src='<%=basePath %>/dwr/util.js'></script>
	
	<script type="text/javascript" src="js/PCASClass.js"></script>
	<script language="javascript" type="text/javascript" src="<%=basePath %>/date/WdatePicker.js"></script>
	<link type="text/css"  href="images/css.css"  rel="stylesheet" />
	<link href="<%=basePath%>/backStageManage/bs.css"  rel="stylesheet" type="text/css" />
	
<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.STYLE15 {color: #F18910}
.STYLE18 {
	color: #0F45C3;
	font-size: 14px;
}

-->
</style>

<script type="text/javascript">
//省份按钮事件
function changeProvinceHandler() {
	//获取省份下拉框的值
	var province = $("#province").val();
//	alert("province=="+province);
	//如果选择了"请选择这个项" (0表示选择了这个项)
	if (province == 0) {
		//删除市和区域下拉的全部选项
		DWRUtil.removeAllOptions("city");
		DWRUtil.addOptions("city", [{"id":0,"name":"请选择..." }], "id", "name");
		DWRUtil.removeAllOptions("area");
		DWRUtil.addOptions("area", [{"id":0,"name":"请选择..." }], "id", "name");
		return;
	} 		
	//删除市下拉的全部选项
	DWRUtil.removeAllOptions("city");
	//根据所选择的省从后台获取相关的市
	areadwr.findAreaByParendIdAndlvType(province, <%= Area.AreaType.CITY%>, function(data){
	DWRUtil.addOptions("city", [{"id":0,"name":"请选择..." }], "id", "name");
	DWRUtil.addOptions("city", data, "id", "name");   //把data数据填充到城市下拉框
	DWRUtil.removeAllOptions("area");   //清除区域的初始值
	DWRUtil.addOptions("area", [{"id":0,"name":"请选择" }], "id", "name");
	});
	
}

//城市按钮事件
function changeCityHandler() {
	var city = $("#city").val();
	//如果选择了"请选择这个项"
	if (city == 0) {
		//删除区下拉的全部选项
		DWRUtil.removeAllOptions("area");
		DWRUtil.addOptions("area", [{"id":0,"name":"请选择..." }], "id", "name");
		return;
	} 
				
	//删除区域下拉的全部选项
	DWRUtil.removeAllOptions("area");
	//根据所选择的市从后台获取相关的区
	areadwr.findAreaByParendIdAndlvType(city, <%= Area.AreaType.AREA%>, function(data) {
	DWRUtil.addOptions("area", [{"id":0,"name":"请选择..." }], "id", "name");
	DWRUtil.addOptions("area", data, "id", "name"); //把data数据填充到区域下拉框
	});
}

function serachInfoSubmit(){
	document.cxFrm.submit();
}

//转至多少页码
function changePage(listId)
{
	 	//alert(listId);
	document.location.href="dmAction!toDataListPage.action?pageNo="+listId;
} 

//全选复选框
 function checkAll() {
	   if ($("#selectAll").attr("checked")) {
		   $("input[name='beadrollBox']").attr("checked", true); 
	   } else {
		   $("input[name='beadrollBox']").attr("checked", false); 
	   }
 }

//删除记录
function delAllBeadroll() {
	if($("input[name='beadrollBox'][checked='true']").length==0) {
		alert("请选择要删除的记录.");
		return false;
	}else{
		if(confirm('您确定要删除多条记录？')){
			$("#delCheckboxForm").submit();
		}else{
			return false;
		}
	}
	
}

</script>

</head>
  
<body style="margin:0px; text-align:center;" >
 <div id="top">
 	<!-- 头部-->
 	<%@include file="/manage/mainTop.jsp"%>
</div>
<div id="top2"></div> 
 <!-- 中间-->
<div id="main1">  
<!-- 左边-->
 <%@include file="/manage/mainLeft.jsp"%>
 <div class="mainr2"> 
    <table width="789" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
  <tr>
    <td align="left" valign="top" ><table width="788" height="422" border="0" cellpadding="0" cellspacing="0" style="border-bottom:1px solid #DBDBDB; border-left:1px solid #DBDBDB; " id="a1">
      <tr>
        <td width="112" height="22" align="center" bgcolor="#FFFFFF" style="border-top:1px solid #DBDBDB; border-right:1px solid #DBDBDB;" >数据列表</td>
        <td width="8" style="border-bottom:1px solid #DBDBDB;">&nbsp;</td>
        <td width="112" align="center" background="images/line3.jpg"  style="border:1px solid #DBDBDB;">
        	<a href="dmAction!toAddDataPage.action" class="STYLE11">添加新数据</a>
        </td>
        
        <td width="7" style="border-bottom:1px solid #DBDBDB;">&nbsp;</td>
        <td width="110" align="center" background="images/line3.jpg"   style="border:1px solid #DBDBDB; ">
        	<a href="dmAction!toBatchImportDataPage.action" class="STYLE11">批量导入</a>
        </td>
        <td width="445" style="border-bottom:1px solid #DBDBDB;">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="10" align="center" valign="top" bgcolor="#FFFFFF" style="border-right:1px solid #DBDBDB;">
        <table width="775" border="0" cellpadding="0" cellspacing="0">
 <s:form name="cxFrm" id="cxFrm" action="dmAction!toDataListPage.action" method="post">
        <tr>
          <td width="99" height="50" align="right">所在地区：</td>
          <td colspan="2" align="left" valign="middle">
          	<s:select name="beadroll.provinceArea.id" onchange="changeProvinceHandler();" id="province" list="provinces" headerKey="0" style="width:20%;" headerValue="请选择..." listValue="name" listKey="id" > </s:select>
			省
			<s:select id="city" list="cityList" name="beadroll.cityArea.id" listValue="name" listKey="id" style="width:15%;" headerKey="0" headerValue="请选择..."></s:select>
			市
			<%--<s:select list="#{0:'请选择...'}" id="area" name="area" listValue="name" listKey="id" style="width:20%;" ></s:select>
			区 --%>
        </tr>
        <tr>
          <td width="99" align="right">&nbsp;</td>
          <td width="531" align="left" valign="middle">
	          	<img src="images/ss3.jpg"  onClick="javascript:serachInfoSubmit();" style="cursor:hand" width="92" height="24" border="0">
          </td>
          <td width="145" align="left" valign="bottom" class="STYLE18">
          <span class="STYLE18">
          	<a href="dmAction!toAddDataPage.action" class="STYLE18">添加新数据</a>
          </span> 
          	<a href="dmAction!toBatchImportDataPage.action" class="STYLE18">批量导入</a>
          </td>
        </tr>
  </s:form>      
        <tr>
          <td width="99" height="14" align="right">&nbsp;</td>
          <td width="531" align="left" valign="middle">&nbsp;</td>
          <td width="145" align="left" valign="bottom" class="STYLE18">&nbsp;</td>
        </tr>
        <tr>
          <td height="147" colspan="3" align="center" valign="top">
<s:form name="delCheckboxForm" id="delCheckboxForm" action="dmAction!doDelAllBeadroll.action" method="post" > 
          <table width="766" border="0" cellpadding="0" cellspacing="0">
		       <tr>
		       	  <td width="44" align="center" background="images/lm1_bg.jpg">选择</td>
		       	  <td width="10" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="220" align="center" background="images/lm1_bg.jpg">公司名称</td>
		          <td width="10" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="105" align="center" background="images/lm1_bg.jpg">联系人</td>
		          <td width="10" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="90" align="center" background="images/lm1_bg.jpg">职位</td>
		          <td width="10" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="90" align="center" background="images/lm1_bg.jpg">移动电话</td>
		          <td width="10" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="120" align="center" background="images/lm1_bg.jpg">所在地区</td>
		          <td width="11" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" alt="" width="10" height="25" /></td>
		          <td width="80" align="center" background="images/lm1_bg.jpg">操作</td>
		       </tr>
        
		    <!--Begin 显示数据的列表 --> 
		 	<s:iterator value="beadrollPage.data" id="beadrollObj" status="st"> 
		        <tr <s:if test="#st.odd">style="background-color:#F7F7F7"</s:if>>
		          <td height="28" align="center">
		          	<input type="checkbox" name="beadrollBox" id="beadrollBox" value="${beadrollObj.id}" />
		          </td>
		          <td>&nbsp;</td>
		          <td height="30" align="center"><s:property value="beadrollPage.data[#st.index].company"/></td>
		          <td>&nbsp;</td>
		          <td align="center"><s:property value="beadrollPage.data[#st.index].linkman"/></td>
		          <td>&nbsp;</td>
		          <td align="center"><s:property value="beadrollPage.data[#st.index].position"/></td>
		          <td align="center">&nbsp;</td>
		          <td align="center"><s:property value="beadrollPage.data[#st.index].mobile"/></td>
		          <td align="center">&nbsp;</td>
		          <td align="center">
		          	<s:property value="beadrollPage.data[#st.index].provinceArea.name"/>&nbsp;&nbsp;
		          	<s:property value="beadrollPage.data[#st.index].cityArea.name"/>
		          </td>
		          <td align="center">&nbsp;</td>
		          <td align="center" class="lbsx">
			          <table width="90" height="28" border="0" cellpadding="0" cellspacing="0">
			            <tr>
			              <td width="90">
				              <a href="dmAction!toBeadrollLookDetail.action?bid=${beadrollObj.id}">查看</a>
				              <a href="dmAction!toEditBeadrollInfo.action?bid=${beadrollObj.id}">编辑</a>
				              <a href="dmAction!doDelBeadrollRecord.action?bid=${beadrollObj.id}" onClick="javascript:return confirm('您确定要删除此信息？')">删除</a>
			              </td>
			            </tr>
			          </table>
		          </td>
		        </tr>
		     </s:iterator>
		     <!--End  显示数据的列表 -->
     
        <tr align="right">
          <!-- 分页 -->
          <td colspan="13" height="28" background="images/lm1_bg.jpg" >
<table width="765" border="0" cellspacing="0" cellpadding="0">
   <s:if test="beadrollPage.data != null">
        <s:if test="beadrollPage.hasOnePage==false">
            <tr>
              <td width="42" height="22" align="center"><input type="checkbox" name="allchk" id="selectAll" onclick="javascript:checkAll();" /></td>
              <td width="42">全选</td>
              <td width="66"><img src="images/sc2.jpg" style="cursor:hand" width="66" height="19" onClick="javascript:delAllBeadroll();"></td>
              <td width="106">&nbsp;</td>
              <td align="right">
              <s:if test="beadrollPage.pageNo==1">首页</s:if>
			  <s:else>
				  <a href="dmAction!toDataListPage.action?pageNo=1" class="STYLE5">首页</a> 
			  </s:else>&nbsp;
              
              <s:if test="beadrollPage.hasPrePage==false">上一页</s:if>
			  <s:else> 
				 <a href="dmAction!toDataListPage.action?pageNo=<s:property value="beadrollPage.pageNo-1"/>" class="STYLE5">上一页</a>
			  </s:else>&nbsp;

              <s:if test="beadrollPage.hasNextPage==false">下一页</s:if>
		      <s:else>
				 <a href="dmAction!toDataListPage.action?pageNo=<s:property value="beadrollPage.pageNo+1"/>" class="STYLE5">下一页</a>
			  </s:else>&nbsp;
              
              <s:if test="beadrollPage.pageNo==beadrollPage.totalPage">末页</s:if>
			  <s:else>
			    <a href="dmAction!toDataListPage.action?pageNo=<s:property value="beadrollPage.totalPage"/>" class="STYLE5"> 末页 </a>
			  </s:else>
              
              &nbsp;&nbsp;第${beadrollPage.pageNo}页&nbsp;|&nbsp;
                                    共<s:property value="beadrollPage.totalPage"/>页&nbsp;|&nbsp;
                                    共${beadrollPage.totalRecord}条&nbsp;&nbsp;转至&nbsp;
    			<select onchange="changePage(this.value)" id="pageNo" name="pageNo">
    				<s:iterator value="beadrollPage.listNum" id="msgid" status="st">
    					<option value="<s:property value="beadrollPage.listNum[#st.index]"/>"><s:property value="beadrollPage.listNum[#st.index]"/></option>
    				</s:iterator>
    			</select>&nbsp;&nbsp;
              </td>
            </tr>
      
         </s:if>
         <s:else>
            	<tr>
            		<td width="42" height="22" align="center"><input type="checkbox" name="allchk" id="selectAll" onclick="javascript:checkAll();" /></td>
		              <td width="42">全选</td>
		              <td width="66"><img src="images/sc2.jpg" style="cursor:hand" width="66" height="19" onClick="javascript:delAllBeadroll();"></td>
		              <td width="106">&nbsp;</td>
	              <td colspan="9" height="29" align="right" background="images/lm1_bg.jpg" >
				 	首页&nbsp;上一页&nbsp;下一页&nbsp;末页           
	              	&nbsp;&nbsp;第1页&nbsp;|&nbsp;共1页&nbsp;|&nbsp;&nbsp;
	    		  </td>
	            </tr>
         </s:else>
            
   </s:if>
   <s:else>
          <tr>
		      <td height="29" colspan="13" align="center" background="images/lm1_bg.jpg" >
				<p style="color: blue;font-size: 12px;text-align: center;">暂无数据记录!</p>
		      </td>
		  </tr>	 
  </s:else>	 
  <%-- 分页结束 --%>
	    </table>   
	             
          </td>
      </tr>
      <tr>
          <td height="25" colspan="13" align="right" class="STYLE15">&nbsp;</td>
      </tr>
      </table>          
  </s:form>
      </td>
        </tr>
    </table>
        </td>
      </tr>
      
      <tr>
      	<td colspan="6">&nbsp;</td>
      </tr>
      
    </table>
    
      </td>
  </tr>
</table>

</div>

</div>

<p>&nbsp;<p/>
<SCRIPT type="text/javascript">
  var pageno = '<%= request.getParameter("pageNo")%>';
  $("#pageNo").val(pageno);
</SCRIPT>
  </body>
</html>
